Skip to content

Conversation

@Majoodeh
Copy link

No description provided.

@durw4rd durw4rd self-assigned this Nov 1, 2025
Copy link

@durw4rd durw4rd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job finishing the assignment for this week, Majd. I left a note about validating the requests; no need to refactor this week's work, but validation will become more important as the applications get more complex.

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"dev": "nodemon server.js"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that you use nodemon

Comment on lines +14 to +18
app.post('/weather', (req, res) => {
console.log(req.body);
const { cityName } = req.body;
res.json(`the city name is ${cityName} `);
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the successful response requires the presence of a certain attribute in the request, it's a good practice to validate the request in your handler. What should the application do if cityName is missing?

This was not mentioned as a requirement in the instructions, so don't worry too much about it, but it's good to start thinking about these things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants